import http from '@/http'
import { PageResponse } from '@/types'
import * as T from './types'

export const API_PRE = 'http://localhost:8080'

/**
 * 权限-分页查询
 */
export const selectPermsPageApi = http.post<T.PermissionReq, PageResponse<T.PermissionRes>>(`${API_PRE}/auth/permission/page`)

/**
 * 权限-详情
 */
export const queryDetailApi = http.get<{ permissionId: number }, T.PermissionDetailRes>(`${API_PRE}/auth/permission/detail`)

/**
 * 权限-保存
 */
export const savePermissionApi = http.post<T.PermissionEditParams>(`${API_PRE}/auth/permission/save`)

/**
 * 权限-修改
 */
export const updatePermissionApi = http.post<T.PermissionEditParams>(`${API_PRE}/auth/permission/update`)

/**
 * 权限-删除
 */
export const deletePermissionApi = http.get<{ permissionId: number }>(`${API_PRE}/auth/permission/delete`)